# Importing Data
VENEZUELA<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Aluminium/Aluminium.xlsx",sheet = "Sheet1", range = "AK1:AK229")

# Checking the Imported Data
View(VENEZUELA)
# Creating Time Series Data
VENEZUELA_ts <- ts(VENEZUELA, start=c(1998,1), end=c(2016,12), frequency=12)
# Viewing and Checking the Created Time Series Data
VENEZUELA_ts
sum(is.na(VENEZUELA_ts))
library(forecast)
VENEZUELA_ts <- tsclean(VENEZUELA_ts)
VENEZUELA_ts

# Identification: Plotting the Time Series Data
plot(VENEZUELA_ts)

# Estimating the appropriate model
VENEZUELA_ts_model <- auto.arima(VENEZUELA_ts)
VENEZUELA_ts_model

# Forecasting
options(max.print=1000000)
VENEZUELA_ts_forecast <- forecast (VENEZUELA_ts_model, level=c(95), h=288)
plot(VENEZUELA_ts_forecast)
VENEZUELA_ts_forecast             

# Exporting
write.table(VENEZUELA_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Aluminium/VENEZUELA_TSA.csv", sep=",")
